<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 财务收支记录数据表
 *
 * Date: 19/03/2018
 * @author George
 */
class CreateFinancesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('finances', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('company_id')->index()->comment('公司ID');
            $table->unsignedInteger('project_id')->index()->comment('项目ID');
            $table->string('year')->comment('年份');
            $table->string('month')->comment('月份');
            $table->string('name')->comment('记录名称');
            $table->string('type')->comment('类型');
            $table->integer('amount')->comment('金额');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('finances');
    }
}
